﻿<html>

<head>
</head>

<body>

<h1>Lista de Todos os Posts</h1>

	<table border="1">
		<tr>
		<th>Titulo</th>
		<th>Ação</th>
		</tr>
		<?php
			$xml = new DomDocument();
			$xml->load('../blog.xml');
			$posts = $xml->getElementsByTagName('post');
			
			foreach($posts as $post){
				$id = $post->getAttribute('idPost');
				$idUsuario = $post->getAttribute('idUsuario');
				$postResul = $post->getElementsByTagName('titulo')->item(0)->nodeValue;
				
				echo "<tr>
					    <td>{$postResul}</td>
						<td><a href=\"alterarPost.php?id={$id}\">Visualizar/Alterar</a>
						&nbsp;
						<a href=\"deletarPost.php?id={$id}\">Remover</a>
						</td>
					</tr>";
			}
		?>		
	</table>
	<a href="index.php">Voltar</a>
</body>
</html>